import java.io.UnsupportedEncodingException;
import java.util.*;
public class Test {
	public static void main(String[] args) throws UnsupportedEncodingException {
		System.out.println("请输入您需要计算周长和面积的图形(仅支持矩形和圆形)：");
		Scanner s = new Scanner(System.in);
		String figure = s.next();
		figure = new String(figure.getBytes("gbk"),"utf-8");
		if(!figure.equals("圆形")&&!figure.equals("矩形")){
			System.out.println("暂时不支持计算其他类型");
		}
		if (figure.equals("矩形")){
			System.out.println("请分别输入矩形的长和宽:");
			double length = s.nextDouble();
			double width = s.nextDouble();
			Rectangle rectangle = new Rectangle();
			if(length<=0||width<=0){
				System.out.println("输入错误");
			} else {
				rectangle.length = length;
				rectangle.width = width;
				rectangle.print();
			}
		}
		if(figure.equals("圆形")){
			System.out.println("请输入圆形的半径:");
			double raidus = s.nextDouble();
			Circle circle = new Circle();
			if(raidus<=0){
				System.out.println("输入错误");
			} else {
				circle.radius = raidus;
				circle.print();
			}
		}
	}
}
